<?php
declare(strict_types=1);

namespace App\Utils\Other\Payment\Chinapnrpay;

/**
 * 支付单报关
 * @package App\Utils\Other\Payment\Chinapnrpay
 */
Class Declares extends App {

    /**
     * 推送支付单
     * @param array $params
     * @return array
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function push(array $params): array
    {
        $this->setConfig([
            'params_sort' => [
                'version', 'bgUrl', 'signType', 'merchantAcctId', 'terminalId',
                'dealId', 'customCode', 'customVersion', 'merCustomCode', 'merCustomName',
                'payerIdType', 'payerName', 'payerIdNumber', 'orderId', 'orderCurrency',
                'orderAmt', 'freightAmt', 'goodsAmt', 'taxAmt', 'offsetAmt'
            ],
            'path' => 'custom/applyImptDec.do'
        ]);
        $params['customCode'] = $this->getConfig('custom_code');
        $params['merCustomCode'] = $this->getConfig('mer_custom_code');
        $params['merCustomName'] = $this->getConfig('mer_custom_name');
        $params['version'] = '1.0';

        return $this->request($params);
    }
}